SD-1460 - fix: don't drop track format on run nodes#1850
SD-1460 - fix: don't drop track format on run nodes#1850chittolinag wants to merge 4 commits intomainfrom
Conversation
| * @returns {Object|undefined} Properties element for trackFormat change or undefined. | ||
| */ | ||
| export const createTrackStyleMark = (marks) => { | ||
| export const decodeTrackFormatMark = (marks) => { |
There was a problem hiding this comment.
Renamed this - the current name seems counter-intuitive, it's not creating a mark, but instead decoding it back to OOXML.
Thoughts?
packages/super-editor/src/core/super-converter/v3/handlers/w/r/r-translator.js
Outdated
Show resolved
Hide resolved
packages/super-editor/src/core/super-converter/v3/handlers/w/r/r-translator.js
Show resolved
Hide resolved
caio-pizzol
left a comment
There was a problem hiding this comment.
approach looks right — adding w:rPrChange generation at the r-translator.decode level is the correct place for this. left one inline comment worth addressing before merge: trackFormat marks aren't excluded from preservedMarks the same way trackInsert and trackDelete are, which is inconsistent with the function's intent. the fix is a one-liner. everything else looks good.
| (mark) => mark?.type === TrackInsertMarkName || mark?.type === TrackDeleteMarkName, | ||
|
|
||
| const trackingMarks = marks.filter((mark) => | ||
| [TrackInsertMarkName, TrackDeleteMarkName, TrackFormatMarkName].includes(mark?.type), |
There was a problem hiding this comment.
trackFormat is now collected into trackingMarksByType here, but the preservedMarks filter on line ~42 still only removes trackInsert and trackDelete — so trackFormat ends up in both places and gets pushed onto children too. nothing downstream processes it today, so no duplicate output — but it's inconsistent with the function's intent. worth aligning the preservedMarks filter too?
const preservedMarks = marks
.filter((mark) => ![TrackInsertMarkName, TrackDeleteMarkName, TrackFormatMarkName].includes(mark?.type))
.map((mark) => cloneMark(mark));
Tracked formatting changes were being dropped after export.
The reason is that we were not re-generating the
rPrChangeelement before decoding the run node. We do encode them correctly, but we were just missing doing it in the opposite direction.